<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var jsonStr1 = '{"name":"张三"}';
        var jsonStr2 = '{"id":1,"name":"张三","age":18}';
        /*json转js*/
        var jsObj1 = JSON.parse(jsonStr1);
        var jsobj2 = {name:"张三"};
        /*js转json*/
        var jsonStr3 = JSON.stringify(jsObj1);
        console.log(jsObj1);
        console.log(jsObj1.name);
        console.log(jsonStr1);
        console.log(jsonStr3);

    </script>
</head>
<body>

</body>
</html>